﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Cephei
{
    public interface ICollection : ICell
    {
        ICell this[string key] { get; set; }
    }

    public interface IVector<T> : IList<T>, ICell
    {
    }
    public interface IMatrix<T> : IVector<IVector<T>>
    {
        T this[int x, int y] { get; set; }
    }
    public interface ICube<T> : IVector<IMatrix<T>>
    {
        T this[int x, int y, int z] { get; set; }
    }

    /// <summary>
    /// Cephei collections are optimised for concurrent, distributed access
    /// to underlying native vectors, with minimal data copying.  They have been designed
    /// to be used in pricing servers where points in a vector can changed quickly.
    /// </summary>
    /// <typeparam name="T">underlying type</typeparam>
    public interface ICollection_Factory<T, U>
    {
        /// <summary>
        /// Create a hybrid List&lt&gt/std:vector&lt&gt of objects, with event notification of changes
        /// </summary>
        /// <returns>a new collection object</returns>
        IVector<T> CreateVector ();
        IVector<T> CreateVector (IEnumerable<T> source);

        /// <summary>
        /// Create a hybrid List&ltList&lt&gt&gt/std:vector&ltstd:vector&lt&gt &gt of objects, with event notification of changes
        /// </summary>
        /// <returns>a new collection object</returns>
        IMatrix<T> CreateMatrix ();
        IMatrix<T> CreateMatrix (IEnumerable<IVector<T>> source);

        /// <summary>
        /// Create a hybrid List&ltList&ltList&lt&gt&gt&gt/std:vector&ltstd:vector&ltstd:vector&lt&gt &gt &gt of objects,  with event notification of changes
        /// </summary>
        /// <returns>a new collection object</returns>
        ICube<T> CreateCube ();
        ICube<T> CreateCube (IEnumerable<IMatrix<T>> source);

        /// <summary>
        /// Create Cell of Vectors of Cells with the underlying type.  The implementation of the 
        /// vector will also subscribe to the ICell notification events of the Contained cells 
        /// </summary>
        /// <returns>a cell containing the new collection</returns>
        Generic.ICell<IVector<U>> CreateCellVector ();
        Generic.ICell<IVector<U>> CreateCellVector (IEnumerable<U> source);

        /// <summary>
        /// Same as Cell&ltVector&ltCell&lt&gt&gt, but with IMatrix&lt&gt underlying
        /// </summary>
        /// <returns></returns>
        /// <returns>a cell containing the new collection</returns>
        Generic.ICell<IMatrix<U>> CreateCellMatrix ();
        Generic.ICell<IMatrix<U>> CreateCellMatrix (IEnumerable<IVector<U>> source);

        /// <summary>
        /// Same as Cell&ltMatrix&ltCell&lt&gt&gt&gt, but with ICube&lt&gt underlying
        /// </summary>
        /// <returns>a cell containing the new collection</returns>
        Generic.ICell<ICube<U>> CreateCellCube ();
        Generic.ICell<ICube<U>> CreateCellCube (IEnumerable<IMatrix<U>> source);
    }
    public interface Double_Factory : ICollection_Factory<double, Generic.ICell<double>> { }
    public interface Int_Factory : ICollection_Factory<int, Generic.ICell<int>> { }
    public interface UInt_Factory : ICollection_Factory<UInt32, Generic.ICell<UInt32>> { }
    public interface Long_Factory : ICollection_Factory<long, Generic.ICell<long>> { }
    public interface ULong_Factory : ICollection_Factory<UInt64, Generic.ICell<UInt64>> { }
    public interface DateTime_Factory : ICollection_Factory<DateTime, Generic.ICell<DateTime>> { }
    public interface Bool_Factory : ICollection_Factory<bool, Generic.ICell<bool>> { }
    public interface String_Factory : ICollection_Factory<string, Generic.ICell<string>> { }
}
